Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchableSnapshotsIntegTests should wait for shard index folder to be cleaned up #80341

Merged
merged 1 commit into from
Nov 5, 2021

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Nov 4, 2021

The tests SearchableSnapshotsIntegTests.testCreateAndRestoreSearchableSnapshot and FrozenSearchableSnapshotsIntegTests.testCreateAndRestorePartialSearchableSnapshot both failed once when asserting the shard folders using assertShardFolders(index, true).

The failures occurred when the original index is first closed (not deleted) and mounted again under the same name (so it will be restored as a searchable snapshot index on top of the existing shard files). The SearchableSnapshotDirectory implementation takes care to clean up the shard files on disk using SearchableSnapshotDirectory.cleanExistingRegularShardFiles() and the tests verify that the shard index folder is indeed deleted from disk on all nodes but sometime fail because the folder is still present.

I wasn't able to reproduce but I think that the closing of the original index + the creation of the .snapshot-blob-cache index trigger some shard relocations that are cancelled by the subsequent mount/restore, leaving some files on disk that should be cleaned up but maybe not immediately.

This pull request changes the tests to assertBusy() when verifying the shard folders and also adds more logging information in case waiting for the assertShardFolders(index, true) is not enough.

Closes #77831

@tlrx tlrx added >test Issues or PRs that are addressing/adding tests :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v7.16.0 v8.1.0 labels Nov 4, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Nov 4, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@@ -75,7 +77,7 @@ protected boolean addMockInternalEngine() {

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return List.of(LocalStateSearchableSnapshots.class);
return CollectionUtils.appendToCopy(super.nodePlugins(), LocalStateSearchableSnapshots.class);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is independant but looks wrong so I fixed it.

Copy link
Contributor

@arteam arteam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's see if assertBusy makes any difference

@tlrx tlrx merged commit c633615 into elastic:master Nov 5, 2021
@tlrx tlrx deleted the assert-busy-hard-folders branch November 5, 2021 08:48
@tlrx
Copy link
Member Author

tlrx commented Nov 5, 2021

Thanks Artem!

tlrx added a commit to tlrx/elasticsearch that referenced this pull request Nov 5, 2021
The tests testCreateAndRestoreSearchableSnapshot and 
testCreateAndRestorePartialSearchableSnapshot both 
failed once when asserting the shard folders using 
assertShardFolders(index, true).

The failures occurred when the original index is first closed 
(not deleted) and mounted again under the same name (so 
it will be restored as a searchable snapshot index on top of 
the existing shard files). The SearchableSnapshotDirectory 
implementation takes care to clean up the shard files on disk 
using SearchableSnapshotDirectory.cleanExistingRegularShardFiles() 
and the tests verify that the shard index folder is indeed deleted 
from disk on all nodes but sometime fail because the folder 
is still present.

I wasn't able to reproduce but I think that the closing of the 
original index + the creation of the .snapshot-blob-cache 
index trigger some shard relocations that are cancelled by 
the subsequent mount/restore, leaving some files on disk 
that should be cleaned up but maybe not immediately.

This commit changes the tests to assertBusy() when 
verifying the shard folders and also adds more logging 
information in case waiting for the 
assertShardFolders(index, true) is not enough.

Closes elastic#77831
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.0
7.16 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 80341

elasticsearchmachine pushed a commit that referenced this pull request Nov 5, 2021
The tests testCreateAndRestoreSearchableSnapshot and 
testCreateAndRestorePartialSearchableSnapshot both 
failed once when asserting the shard folders using 
assertShardFolders(index, true).

The failures occurred when the original index is first closed 
(not deleted) and mounted again under the same name (so 
it will be restored as a searchable snapshot index on top of 
the existing shard files). The SearchableSnapshotDirectory 
implementation takes care to clean up the shard files on disk 
using SearchableSnapshotDirectory.cleanExistingRegularShardFiles() 
and the tests verify that the shard index folder is indeed deleted 
from disk on all nodes but sometime fail because the folder 
is still present.

I wasn't able to reproduce but I think that the closing of the 
original index + the creation of the .snapshot-blob-cache 
index trigger some shard relocations that are cancelled by 
the subsequent mount/restore, leaving some files on disk 
that should be cleaned up but maybe not immediately.

This commit changes the tests to assertBusy() when 
verifying the shard folders and also adds more logging 
information in case waiting for the 
assertShardFolders(index, true) is not enough.

Closes #77831
tlrx added a commit to tlrx/elasticsearch that referenced this pull request Nov 5, 2021
The tests testCreateAndRestoreSearchableSnapshot and
testCreateAndRestorePartialSearchableSnapshot both
failed once when asserting the shard folders using
assertShardFolders(index, true).

The failures occurred when the original index is first closed
(not deleted) and mounted again under the same name (so
it will be restored as a searchable snapshot index on top of
the existing shard files). The SearchableSnapshotDirectory
implementation takes care to clean up the shard files on disk
using SearchableSnapshotDirectory.cleanExistingRegularShardFiles()
and the tests verify that the shard index folder is indeed deleted
from disk on all nodes but sometime fail because the folder
is still present.

I wasn't able to reproduce but I think that the closing of the
original index + the creation of the .snapshot-blob-cache
index trigger some shard relocations that are cancelled by
the subsequent mount/restore, leaving some files on disk
that should be cleaned up but maybe not immediately.

This commit changes the tests to assertBusy() when
verifying the shard folders and also adds more logging
information in case waiting for the
assertShardFolders(index, true) is not enough.

Closes elastic#77831
elasticsearchmachine pushed a commit that referenced this pull request Nov 8, 2021
The tests testCreateAndRestoreSearchableSnapshot and
testCreateAndRestorePartialSearchableSnapshot both
failed once when asserting the shard folders using
assertShardFolders(index, true).

The failures occurred when the original index is first closed
(not deleted) and mounted again under the same name (so
it will be restored as a searchable snapshot index on top of
the existing shard files). The SearchableSnapshotDirectory
implementation takes care to clean up the shard files on disk
using SearchableSnapshotDirectory.cleanExistingRegularShardFiles()
and the tests verify that the shard index folder is indeed deleted
from disk on all nodes but sometime fail because the folder
is still present.

I wasn't able to reproduce but I think that the closing of the
original index + the creation of the .snapshot-blob-cache
index trigger some shard relocations that are cancelled by
the subsequent mount/restore, leaving some files on disk
that should be cleaned up but maybe not immediately.

This commit changes the tests to assertBusy() when
verifying the shard folders and also adds more logging
information in case waiting for the
assertShardFolders(index, true) is not enough.

Closes #77831
arteam added a commit to arteam/elasticsearch that referenced this pull request Mar 14, 2022
arteam added a commit that referenced this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. >test Issues or PRs that are addressing/adding tests v7.16.0 v8.0.0-rc1 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] SearchableSnapshotsIntegTests testCreateAndRestoreSearchableSnapshot failing
5 participants